import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
import { LV, PathName } from './GameConstant';
import { ZTool } from '../AshFramework/Utils/ZTool';
import { PrefsManager } from './PrefsManager';
import { BundleManager } from '../AshFramework/Managers/BundleManager';
import { ResourceUtil } from '../AshFramework/Utils/ResourceUtil';
const { ccclass, property } = _decorator;

@ccclass('Path')
export class Path extends Component {

    Paths: Node[] = [];
    Barriers: string[] = [];
    CurIndex: number = 0;

    protected onLoad(): void {
        this.node.children.forEach(e => {
            if (PathName.find(s => s === e.name)) {
                this.Paths.push(e);
            }
        });
        // this.Barriers = Barrier[ZTool.GetEnumKeyByValue(LV, PrefsManager.Instance.userData.CurLV)];
    }

    protected start(): void {
        this.CurIndex = 0;
        // this.initBarrier();
    }

    // initBarrier() {
    //     for (let i = 0; i < this.Paths.length; i++) {
    //         ResourceUtil.LoadPrefab("Barrier/" + this.Barriers[i]).then((prefab: Prefab) => {
    //             const barrierNode: Node = instantiate(prefab);
    //             barrierNode.parent = this.Paths[i];
    //         })

    //     }
    // }
}


